<div style="text-align: center">
    <image id ="qrcode" name = "qrcode" style="max-width:300px;max-height:300px;" src="{$url}"/>
</div>
<script>
    /**
     * 下载二维码
     */
    function downloadQrcode() {  
        var filename = '1.png'; 
        // 创建隐藏的可下载链接
        var eleLink = document.createElement('a');
        eleLink.download = filename;
        eleLink.style.display = 'none';
        // 字符内容转变成blob地址 
        eleLink.href = document.getElementById("qrcode").src;
        // 触发点击
        document.body.appendChild(eleLink);
        eleLink.click();
        // 然后移除
        document.body.removeChild(eleLink); 
    }
</script>